home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
3D Game Programming All in One
/
3D Game Programming All in One Disc.iso
/
3D2E
/
RESOURCES
/
CH3
/
turnshape.cs
< prev
Wrap
Text File
|
2006-06-28
|
1KB
|
27 lines
// ========================================================================
// turnshape.cs
//
// This module contains a function for turning a specified shape.
// ========================================================================
function TurnShape(%shape, %angle)
// ----------------------------------------------------
// turns the %shape by %angle amount.
// ----------------------------------------------------
{
echo ("TurnShape: shape id: ", %shape);
echo ("TurnShape: angle: ", %angle);
%xfrm = %shape.getTransform();
%lx = getword(%xfrm,0); // first, get the current transform values
%ly = getword(%xfrm,1);
%lz = getword(%xfrm,2);
%rx = getword(%xfrm,3);
%ry = getword(%xfrm,4);
%rz = getword(%xfrm,5);
%angle += 1.0; // increment the angle (ie. rotate it a bit)
%rd = %angle; // Set the rotation angle
%shape.setTransform(%lx SPC %ly SPC %lz SPC %rx SPC %ry SPC %rz SPC %rd);
echo ("TurnShape: done.");
}